package com.cardbaobao.cardbabyclient.buried;

import com.cardbaobao.cardbabyclient.utils.ApplicationHelper;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;

/**
 * Description: google analytics 工具类
 * Created by FHW
 * on 2017/7/7
 */

public class GoogleAnalyticsUtil {

    private static Tracker mTracker;

    public static void setScreenName(String s) {
        mTracker = ApplicationHelper.getApplication().getDefaultTracker();
        mTracker.setScreenName(s);
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
    }

    public static void setScreenAction(String category, String action) {
        mTracker = ApplicationHelper.getApplication().getDefaultTracker();
        mTracker.send(new HitBuilders.EventBuilder()
                .setCategory(category)
                .setAction(action)
                .build());
    }

    public static void setScreenAction(String category, String action, String label) {
        mTracker = ApplicationHelper.getApplication().getDefaultTracker();
        mTracker.send(new HitBuilders.EventBuilder()
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .build());
    }

}
